/**
 * Copyright(c) Hainan eKing Technology co., LTD
 *
 * @date 2013年8月13日
 * 	
 * Original Author: 郑兴(zhengxing)
 *
 * ChangeLog
 *
 */
package com.hnas.sys.web.system;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hnas.core.dto.DTOPagedList;
import com.hnas.core.dto.DataBean;
import com.hnas.sys.core.util.UserUtils;
import com.hnas.sys.service.system.ILogService;
import com.hnas.sys.service.system.dto.DTOLog;
import com.hnas.sys.service.system.dto.DTOLogSearch;
import com.hnas.sys.service.system.dto.DTOUser;

/**
 * <pre>期权管理控制器</pre>
 * @author 郑兴(zhengxing)
 *
 */
@Controller
@RequestMapping("/backend/system/logInfo")
public class LogInfoController {
	@Autowired
	private ILogService logService;
	
	private Logger log = LoggerFactory.getLogger(LogInfoController.class);
	
	
	@RequestMapping("/search")
	public String search(ModelMap modelMap, HttpServletRequest request,
			@ModelAttribute("criteria") DTOLogSearch criteria) {

		try {
//			String page = request.getParameter((new ParamEncoder("values")
//					.encodeParameterName(TableTagParameters.PARAMETER_PAGE)));
//			/**
//			 * if (!"false".equals(request.getParameter("firstInvoke"))) {
//			 * modelMap.put("resultSize", 0); return
//			 * "backend/product/searchProviders"; }
//			 **/
//			if (null == page) {
//				criteria.setPageNo(1);
//			} else {
//				criteria.setPageNo(Integer.parseInt(page));
//			}
			criteria.setTotalCount(-1);
			DTOUser user = UserUtils.getCurrentUser();

			DTOPagedList<DTOLog> pg = this.logService.searchLog(criteria);
//			modelMap.put("citys", pg.getList());
			modelMap.put("pg", pg);
//			modelMap.put("resultSize", pg.getTotalCount());
			modelMap.put("dto", criteria);
		} catch (Exception e) {
			log.error("", e);
			modelMap.put("resultSize", 0);
		}
		modelMap.put("pageTitle", "日志查询");
		List<DataBean> beans = new ArrayList<DataBean>();
		beans.add(new DataBean("objectType","对象"));
		beans.add(new DataBean("operatorName","操作人"));
		beans.add(new DataBean("operateTime","操作时间"));
		beans.add(new DataBean("operateType","操作"));
		beans.add(new DataBean("logInfo","操作信息"));
//		beans.add(new DataBean("priority","排序","int"));
		modelMap.put("beans", beans);
		return "backend/system/log/listLog";
	}
	//导出
}
